<?php
require_once '../../public/inc/DB.php';
$db = new DB('jusmor_resource');

require_once '../../public/inc/FileUpload.php';	
$upload = new FileUpload();

if(! empty($_FILES)) {
	$upload->set('path', '../../upload/resource/')
			->set('allowtype',array('rar', 'doc', 'zip'))
			->set('fileSize', 5242880)
			->set('isRandname', true);
	$resturn = array('code'=>1, 'msg'=>'上传成功！', 'data'=>'');
	
	if($upload->upload('Filedata')) {
		$resturn['data']['filename'] = $upload->getFileName();
		$resturn['data']['filesize'] = $upload->getFileSize();
	} else {
		$resturn['code'] = 0;
		$resturn['msg'] = $upload->getErrorMsg();
	}
	echo json_encode($resturn);
	exit();
}